function getInput(title) {
  let res = window.prompt(title);
  if (res === '' || res === null)
    res = undefined;
  return res;
}

function toMinute(str) {
  let t = str.split(':').map(x => Number(x));
  return t[0] * 60 + t[1];
}

function toTimeString(time) {
  return [time.start, time.end]
    .map(
      x => [Math.floor(x / 60), x % 60]
        .map(x => x < 10 ? 0 + x.toString() : x.toString())
        .join(':')
    )
    .join(' - ');
}


export {
  getInput,
  toMinute,
  toTimeString,
};